import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim, main
from util import *
from dungeon import makeFloor, Room, Brazier

class BrazierRoom(Room):
    # minimum/maximum rooms extents
    minRoomW, minRoomH = 6, 6
    maxRoomW, maxRoomH = 20, 20

    # possible floor colors
    floorColors = [
        'Peru',
        'DimGray',
        'Tan',
        'DarkGoldenRod',
        'Sienna',
        'Chocolate',
        'SaddleBrown',
    ]

    def __init__(self, pos):
        size = (random.randint(self.minRoomW, self.maxRoomW),
                random.randint(self.minRoomH, self.maxRoomH))

        floorColor1 = colors[random.choice(BrazierRoom.floorColors)]
        floorColor2 = colors[random.choice(BrazierRoom.floorColors)]
        mixture = random.random()
        Room.__init__(self, pos, size, floorColor1, floorColor2,
                mixture)
        self.name = 'brazier room'

    def apply(self, map):
        # lay some floor
        floorRect = self.rect.inflate(-2, -2)
        self.floorAreaGenerator.apply(map, floorRect)

        # put braziers in the corners
        for corner in corners(floorRect):
            brazier = Brazier()
            map[corner].add(brazier)
            #brazier.lightSource.apply(map, corner)

        #... and in the center of the room if it's big enough
        if self.rect.w * self.rect.h > 150:
            brazier = Brazier()
            map[self.rect.center].add(brazier)
            #brazier.lightSource.apply(map, self.rect.center)

#=========================================

roomClass = BrazierRoom
